//cookie的获取
function getcookie(key) {
    let strcookie = document.cookie;
    let arrcookie = strcookie.split("; ");


    for (let i in arrcookie) {
        let item = arrcookie[i].split("=");
        if (key == item[0]) {
            return item[1];
        }
    }
    return '';

}

//设置cookie
function setcookie(key, value, day) {
    if (day !== undefined) {
        let d = new Date();
        d.setDate(d.getDate() + day);
        document.cookie = `${key}=${value};expires=` + d;
    } else {
        document.cookie = `${key}=${value}`;
    }
}


//删除cookie
function deletecookie(key) {
    setcookie(key, '', -1)
}